<include file="Public/header" />
<title>管理员列表</title>
<style>
	.red td,.red td a{
		color:red;
	}
	.yellow td,.yellow td a{
		color:yellow;
	}
	.blue td,.yellow td a{
		color:blue;
	}
</style>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 对账单 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20">

	<div class="cl pd-5 bg-1 bk-gray mt-20"> 
		<form class="formleft" name="" id="" action="__URL__/index/" method="get">
			<input class="input-text" style="width:200px" type="text" value="<{$_GET['pay_no']}>" placeholder="支付单号" name="pay_no">
			日期范围：
			<input type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'logmax\')||\'%y-%M-%d\'}'})" id="logmin" name="start_time" value="<{$Think.get.start_time}>" class="input-text Wdate" style="width:120px;">
			-
			<input type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'logmin\')}',maxDate:'%y-%M-%d'})" id="logmax" name="end_time" value="<{$Think.get.end_time}>" class="input-text Wdate" style="width:120px;">
			<button type="submit" class="btn btn-success"><i class="icon-plus"></i> 查询</button>
			<a href="javascript:;" onclick="delAll()" class="btn btn-danger radius">批量删除</a>
			<a href="javascript:;" onclick="exportExcel()" class="btn btn-primary radius">批量导出</a>
		</form>
		<span class="r">共有数据：<strong><{$count}></strong> 条</span> 
    </div>
	
	<table class="table table-border table-bordered table-bg">
		<thead>
			<tr>
				<th scope="col" colspan="15">对账单列表</th>
			</tr>
			<tr class="text-c">
				<th width="25" class="sorting_disabled" rowspan="1" colspan="1" aria-label="" style="width: 25px;"><input type="checkbox" name="" value=""></th>
				<th width="25">序号</th>
				<th width="">日期时间</th>
				<th width="">金额</th>
				<th width="">支付单号</th>
				<th width="">分销商</th>
				<th width=""></th>
			</tr>
		</thead>
		<tbody>
			<volist name="list" id="vo">
			<tr class="text-c <if condition="$vo.color eq 'red'">red</if><if condition="$vo.color eq 'blue'">blue</if>">
				<td><input type="checkbox" value="<{$vo.id}>" name="" class="ids"></td>
				<td><{$i}></td>
				<td><{$vo.add_time}></td>
				<td>
					<{$vo.fee}>
				</td>
				<td><{$vo.pay_no}></td>
				<td><{$vo.agent_name}></td>
				<td>
					<a href="javascript:;" onclick="detail(<{$vo.id}>)" class="radius">订单详情</a>
				</td>
			</tr>
			</volist>
		</tbody>
	</table>
	<div class="page mt" style="text-align:right"><{$page}></div>
</div>
<script>
	function detail(id){
		url='__MODULE__/Checkbill/order/id/'+id+'/'+Math.random(); //iframe的url
		var index=layer.open({
			type: 2,
			title: '订单详情',
			shadeClose: true,
			shade: 0.5,
			area: ['1200px','850px'],
			content: url
		});
	}
	function exportExcel(){
		var url="<{:U('Checkbill/index',array('excel'=>1))}>/?1=1";
		cate=$('select[name=cate]').val();
		mail_no=$('input[name=mail_no]').val();
		order_no=$('input[name=order_no]').val();
		fee=$('input[name=fee]').val();
		start_time=$('input[name=start_time]').val();
		end_time=$('input[name=end_time]').val();
		if(cate!=""){
			url=url+"&cate="+cate;
		}
		if(mail_no!=""){
			url=url+"&mail_no="+mail_no;
		}
		if(order_no!=""){
			url=url+"&order_no="+order_no;
		}
		if(fee!=""){
			url=url+"&fee="+fee;
		}
		if(start_time!=""){
			url=url+"&start_time="+start_time;
		}
		if(end_time!=""){
			url=url+"&end_time="+end_time;
		}
		window.location.href=url;
	}
	//添加
	function add(){
		var url="<{:U('add')}>";
		layer.open({
			title: '添加', type: 2,content:url,area: ['800px', '300px']
		})
	}
	//编辑
	function edit(id){
		var url="<{:U('edit')}>"+"?id="+id;
		layer.open({
			title: '添加', type: 2,content:url,area: ['800px', '600px']
		})
	}
	//设置属性
	function setStatus(value){
		var option = $(".ids");
		var checked_counts=0;
		var check_val = [];
        for(var i=0;i<option.length;i++){
			if(option[i].checked){
				checked_counts++;
				check_val.push(option[i].value);
			}
		}
		if(checked_counts==0){
			layer.msg('请选择内容');
			return false;
		}else{
			$.ajax({
				type: 'POST',
				data: {value:value,ids:check_val},
				url: "<{:U('setStatus')}>",
				success:function(data){
					if(data.status==1){	//检查通过，跳转生成波次单页面
						layer.msg(data.info,function(){
							window.location.reload();
						});
					}else{			//检查未通过，刷新页面
						layer.msg(data.info);
					}
					return false;
				}
			})
		}
	}
	//批量删除
	function delAll(){
		var option = $(".ids");
		var checked_counts=0;
		var check_val = [];
        for(var i=0;i<option.length;i++){
			if(option[i].checked){
				checked_counts++;
				check_val.push(option[i].value);
			}
		}
		if(checked_counts==0){
			layer.msg('请选择内容');
			return false;
		}else{
			$.ajax({
				type: 'POST',
				data: {ids:check_val},
				url: "<{:U('delAll')}>",
				success:function(data){
					if(data.status==1){	//检查通过，跳转生成波次单页面
						layer.msg(data.info,function(){
							window.location.reload();
						});
					}else{			//检查未通过，刷新页面
						layer.msg(data.info);
					}
					return false;
				}
			})
		}
	}
</script>
 <include file="Public/footer" />
<include file="Public/footer_js" />
</body>
</html>